package com.competition.web.admin.task;

import java.util.Set;

import javax.annotation.Resource;

import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 启动清理部门信息
 */
@Component
public class ClearDepartmentCache  {

	private RedisTemplate<String, ?> redisTemplate;
	

//	@Async("threadPoolTaskExecutor")
//	@Scheduled(cron = "${executor-config.cleanCache}")
//	public void clearCache() throws Exception {
//		
//		System.out.println("登录后清理缓存执行了");
//		
//		Set<String> keys = redisTemplate.keys("data-*");
//
//		redisTemplate.delete(keys);
//	}

	@Resource
	public void setRedisTemplate(RedisTemplate<String, ?> redisTemplate) {
		this.redisTemplate = redisTemplate;
	}
}